package biz

import (
	"context"
	"github.com/go-kratos/kratos/v2/log"
)

type Demo struct {
	Name string
}

type DemoRepo interface {
	Save(context.Context, *Demo) (*Demo, error)
	Update(context.Context, *Demo) (*Demo, error)
	FindByID(context.Context, int64) (*Demo, error)
	ListByHello(context.Context, string) ([]*Demo, error)
	ListAll(context.Context) ([]*Demo, error)
}

type DemoUser struct {
	repo DemoRepo
	log  *log.Helper
}

func NewDemoUser(repo DemoRepo, logger log.Logger) *DemoUser {
	return &DemoUser{repo: repo, log: log.NewHelper(logger)}
}

func (du DemoUser) CreateUser(ctx context.Context, demo *Demo) (*Demo, error) {
	return du.repo.Save(ctx, demo)
}
